<?php
include "connect.php" ;
$date=$_POST['date'];
//$board_id=$_POST['board_id'];
$year=$_POST['year'];
$class_id=$_POST['class_id'];
$session_id=$_POST['session_id'];
$dept_id=$_POST['dept_id'];
$tmarks=$_POST['tmarks'];
$subject=$_POST['subject'];

$dbquery="INSERT INTO board (date,year,class_id,session_id,dept_id,subject_id,total_marks) VALUES
('$date','$year','$class_id','$session_id','$dept_id','$subject','$tmarks')";
mysql_query($dbquery) or die (mysql_error());

$board_id = mysql_insert_id();
	
	$sql2=mysql_query("select * from student_subject where session_id=' $session_id' AND class_id='$class_id' AND subject_id='$subject'" ) or die (mysql_error());


while($row=mysql_fetch_array($sql2))
{
$roll=$row['roll_no'];
$board=$_POST['board'.$roll];
$marks=$_POST['marks'.$roll];


$sql=mysql_query("insert into board_detail (board_id,roll_no_board,roll_no,obtain_marks) VALUES ('$board_id','$board','$roll','$marks' )") or die (mysql_error());

}

header("location:board tea.php");
?>
